package com.lzxuni.modules.qualityAssurance.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzxuni.common.utils.StringUtils;
import com.lzxuni.modules.common.entity.PageParameter;
import com.lzxuni.modules.dataAcquisition.entity.Chain;
import com.lzxuni.modules.qualityAssurance.entity.ProductSampling;
import com.lzxuni.modules.qualityAssurance.mapper.ProductSamplingMapper;
import com.lzxuni.modules.qualityAssurance.service.ProductSamplingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 产品抽检 服务实现类
 * </p>
 *
 * @author wzx
 * @since 2019-07-15
 */
@Service
public class ProductSamplingServiceImpl extends ServiceImpl<ProductSamplingMapper, ProductSampling> implements ProductSamplingService {

    @Autowired
    private ProductSamplingMapper samplingMapper;

    @Override
    public PageInfo<ProductSampling> queryPage(PageParameter pageParameter, Map map) throws SQLException {
        PageHelper.startPage(pageParameter.getPage(), pageParameter.getRows()).setOrderBy(
                pageParameter.getSidx() + " " + pageParameter.getSord());
        List<ProductSampling> list = samplingMapper.queryList(map);
        PageInfo<ProductSampling> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public ProductSampling queryOne(String samplingId) throws SQLException {
        return samplingMapper.queryOne(samplingId);
    }

}
